package com.spider.moudle.entity;

import java.util.Date;

/**
 * @author 夏茂轩
 * @package com.spider.silence.proxy
 * @Date 2017/7/28 13:48
 */
public class Proxy {
    private String ip;
    private int port;
    /**
     * 代理平均返回时间
     */
    private double response_lsp;
    private Date refresh_Date=new Date();

    public Proxy(String ip, int port) {
        this.ip = ip;
        this.port = port;
    }

    public Proxy(String ip, int port, double response_lsp) {
        this.ip = ip;
        this.port = port;
        this.response_lsp = response_lsp;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public double getResponse_lsp() {
        return response_lsp;
    }

    public void setResponse_lsp(double response_lsp) {
        this.response_lsp = response_lsp;
        this.refresh_Date=new Date();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Proxy) {
            if (((Proxy) obj).getPort() == this.port && ((Proxy) obj).getIp().equals(this.ip)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
    @Override
    public int hashCode() {
        return this.ip.hashCode()*this.port+this.port;
    }
}
